package cn.iocoder.yudao.adminserver.modules.upload;

import cn.iocoder.yudao.adminserver.framework.aliyun.config.AliyunConfiguration;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * 获取配置信息
 * @author : zhanggy
 * @date : 2021/9/18 21:14
 * @team : 西南综合开发支持部
 * @copyright : Sysware Technology Co., Ltd
 **/
@Api(tags = "配置信息")
@RestController
@RequestMapping("/config/")
@Validated
public class ConfigController {

    @Resource
    AliyunConfiguration aliyun;

    @GetMapping("/getAliyunConfig")
    @ApiOperation("获取阿里云配置信息")
    public CommonResult getAliyunConfig() {
        JSONObject result = new JSONObject();
        result.put("accessKeyId", aliyun.getAccessKeyId());
        result.put("accessKeySecret", aliyun.getAccessKeySecret());
        result.put("endpoint", aliyun.getEndpoint());
        result.put("bucketName", aliyun.getBucketName());
        result.put("region", aliyun.getRegion());
        result.put("storePath", aliyun.getStorePath());
        return success(result);
    }

}
